package xyz.kongbai121.demo.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

/**
 * 私信实体类
 * @author 空白
 */
@Getter
@Setter
@ToString
public class ChatList {
    @TableId(type = IdType.AUTO)
    private Long id;                        //私信id
    private Long userId;                    //用户id
    private String content;                 //私信内容
    private Long toUserId;                  //接收用户id
    private Date ofTime = new Date();       //评论时间
    private int unreadNum;                  //未读私信数

    @TableField(exist = false)
    private User user;                      //用户信息
    @TableField(exist = false)
    private User toUser;                    //接收用户信息

    public ChatList() {
    }

    public ChatList(Long userId, String content, Long toUserId, int unreadNum) {
        this.userId = userId;
        this.content = content;
        this.toUserId = toUserId;
        this.unreadNum = unreadNum;
    }
}
